$(function() {
    $(document).ready(function(e) {
        //一不小心写了两个加载完后执行函数，不管了，下方为表单数据模块
        var $dashChartBarsCnt = jQuery('.js-chartjs-bars')[0].getContext('2d'),
            $dashChartLinesCnt = jQuery('.js-chartjs-lines')[0].getContext('2d');

        var $dashChartBarsData = {
            labels: ['2020/05', '2020/06', '2020/07', '2020/08', '2020/09', '2020/10', '2020/11'],
            datasets: [{
                label: "月度利润核算(万元)",
                borderWidth: 1,
                borderColor: 'rgba(0,0,0,0)',
                backgroundColor: 'rgba(51,202,185,0.5)',
                hoverBackgroundColor: "rgba(51,202,185,0.7)",
                hoverBorderColor: "rgba(0,0,0,0)",
                data: [13, 15, 13.5, 13, 12, 13.5, 15, 10]
            }]
        };
        var $dashChartLinesData = {
            labels: ['2019/12', '2020/01', '2020/02', '2020/03', '2020/04', '2020/05', '2020/06', '2020/07', '2020/08', '2020/09', '2020/10', '2020/11'],
            datasets: [{
                label: '交易资金(万元)',
                data: [80, 89, 70, 20, 30, 40, 55, 40, 48, 40, 42, 50],
                borderColor: '#358ed7',
                backgroundColor: 'rgba(53, 142, 215, 0.175)',
                borderWidth: 1,
                fill: false,
                lineTension: 0.5
            }]
        };

        new Chart($dashChartBarsCnt, {
            type: 'bar',
            data: $dashChartBarsData
        });

        var myLineChart = new Chart($dashChartLinesCnt, {
            type: 'line',
            data: $dashChartLinesData,
        });
        //时间构造器
        class TimeUtils {
            formatDate() {
                let date = new Date();
                let year = date.getFullYear();
                let month = date.getMonth() + 1;
                month = month >= 10 ? month : '0' + month;
                let day = date.getDate();
                day = day >= 10 ? day : '0' + day;
                let hours = date.getHours();
                hours = hours >= 10 ? hours : '0' + hours;
                let minutes = date.getMinutes();
                minutes = minutes >= 10 ? minutes : '0' + minutes;
                let seconds = date.getSeconds();
                seconds = seconds >= 10 ? seconds : '0' + seconds;
                return `${year}-${month}-${day}`;
            }
        }
        let timeUtils = new TimeUtils;
        $('#typename1').val(timeUtils.formatDate())
        $('#typename2').val(timeUtils.formatDate())
    });

})